package cn.com.wdjedu.androidapp.wjeduandroid.ui.videoshow.adpter;

import android.content.Context;

import com.zhy.adapter.abslistview.CommonAdapter;
import com.zhy.adapter.abslistview.ViewHolder;

import java.util.ArrayList;
import java.util.List;

import cn.com.wdjedu.androidapp.wjeduandroid.R;
import cn.com.wdjedu.androidapp.wjeduandroid.support.lib.view.MyListView;
import cn.com.wdjedu.androidapp.wjeduandroid.ui.videoshow.bean.QuestBean;

/**
 * Created by CCY on 2017/2/17.
 * 问答适配器
 */



public class QuestFragmentAdapter extends CommonAdapter<QuestBean> {
    private SubQuestFragmentAdapter adapter;
    private List<QuestBean.SubQuest> lists;
    public QuestFragmentAdapter(Context context, int layoutId, List<QuestBean> datas) {
        super(context, layoutId, datas);
        lists=new ArrayList<>();
        adapter=new SubQuestFragmentAdapter(mContext, R.layout.sub_item_viewshow_quest,lists);
    }

    @Override
    protected void convert(ViewHolder viewHolder, QuestBean item, int position) {
        viewHolder.setText(R.id.item_quest_question,item.getQuestion());
        MyListView myListView=viewHolder.getView(R.id.item_MyQuestListView);
        lists.clear();
        lists.addAll(item.getList());
        myListView.setAdapter(adapter);
        adapter.notifyDataSetChanged();
    }
}
